#pragma once
#include "entity.h"
#include "SGD Wrappers/CSGD_TextureManager.h"
#include "SGD Wrappers\CSGD_Direct3D.h"

#include "Abilities\Abilities.h"
#include <list>
using namespace std;
#include "AnimationMenu.h"
#include "AnimationManager.h"
#include "EventSystem.h"
#include "IListener.h"
#include "NEvent.h"

class CPlayer : public CEntity, public IListener
{
private:
	list<CAbilities*>m_pPlayerAbilities;
	CSGD_TextureManager* m_pTM;
	CSGD_Direct3D* m_pD;
		
	bool m_bPlayerOnPlatform;
	bool m_bOnEnemy;
	int m_nHealth;
	int m_nMaxHealth;
	int m_nPotLifeLoss;
	float m_fTimeLeftForCurrentAbility;
	int m_nHitsNeededForCurrentAbility;
	int m_nCurrentHits;
	float m_fComboTimer;
	bool m_bSpin;
	CAnimationManager*	m_pAM;
	bool m_bFaceing;
	CEventSystem* m_pES;
	int m_nBAttackEffectCount;
	int m_nSpinAttackEffectCount;
	float m_fAttackCooldown;
	float m_fSpinCooldown;
	bool m_bShield;
	int m_nShieldCount;


public:
	CAnimationMenu m_cAniInfo;	

	CPlayer(void);
	~CPlayer(void);

	void Update(float fElapsedTime);
	void Render(void);
	void Init(void);
	bool UseAbility(void);
	bool CheckCollision(IEntity* pOther);
	void OnPlatform(bool bPlatform){m_bPlayerOnPlatform = bPlatform;}
	bool OnPlatform(void)const{return m_bPlayerOnPlatform;}
	void OnEnemy(bool bOnEnemy){m_bOnEnemy = bOnEnemy;}
	void UpdateTimeLeft(void);
	bool OnEnemy(void)const{return m_bOnEnemy;}
	void SetHealth(int nHealth){m_nHealth = nHealth;}
	int GetHealth(void)const{return m_nHealth;}
	void SetMaxHealth(int nMaxHealth){m_nMaxHealth = nMaxHealth;}
	int GetMaxHealth(void)const{return m_nMaxHealth;}
	void SetPotLifeLoss(int nPotLifeLoss);
	void SetTimeLeft(float fTimeLeft){m_fTimeLeftForCurrentAbility = fTimeLeft;}
	float GetTimeLeft(void)const{return m_fTimeLeftForCurrentAbility;}
	void SetHitsNeeded(int nHitsNeeded){m_nHitsNeededForCurrentAbility = nHitsNeeded;}
	int GetHitsNeeded(void)const{return m_nHitsNeededForCurrentAbility;}
	int GetPotLifeLoss(void)const{return m_nPotLifeLoss;}
	void AddAbility(CAbilities* pAbility);
	void AbilityFinished(void);
	void SetCurrentHits(int nCurrentHits){m_nCurrentHits = nCurrentHits;}
	int GetCurrentHits(void)const{return m_nCurrentHits;}
	void SetComboTimer(float fComboTimer){m_fComboTimer = fComboTimer;}
	float GetComboTimer(void)const{return m_fComboTimer;}
	int GetHitReq(void)const{return m_nHitsNeededForCurrentAbility;}
	int GetQueueSize(void)const{return m_pPlayerAbilities.size();}
	void SetSpin(bool bSpin){m_bSpin = bSpin;}
	bool GetSpin(void)const{return m_bSpin;}
	bool GetFacing(void){return m_bFaceing;}
	void SetFacing(bool face){m_bFaceing=face;}

	void SetShield(bool bShield){m_bShield = bShield;}
	bool GetShield(void)const{return m_bShield;}
	void ModShieldCount(int bShield){m_nShieldCount += bShield;} //negatives will lower count.
	int GetShieldCount(void)const{return m_nShieldCount;}

	virtual void HandleEvent(CNEvent* pEvent);
};